package com.cs171.market.holder;

public class CurrentUserHolder {
    // 线程存储类进行权限验证，也可以用session或cookie去做
    private static final ThreadLocal<String>  holder = new ThreadLocal<>();

    public static String get(){
        //提取线程存储的东西
        return holder.get()==null?"null":holder.get();
    }

    public static void set(String username){
        holder.set(username);
    }

}
